package cn.momoshenchi.medicine.controller;

import cn.momoshenchi.medicine.pojo.BaseAccout;
import cn.momoshenchi.medicine.pojo.PrescriptionInfo;
import cn.momoshenchi.medicine.service.PrescriptionInfoService;
import cn.momoshenchi.medicine.util.ResultInfo;
import cn.momoshenchi.medicine.vo.PreDetail;
import cn.momoshenchi.medicine.vo.Prescribe;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/7/13 - 14:46
 */
@RestController
public class PrescribeController
{


    @Autowired
    private PrescriptionInfoService prescriptionInfoService;

    /**
     * 查看处方详情
     * @param consultId
     * @return
     */
    @GetMapping("/prescribe/{consultId}")
    public ResultInfo preDetail(@PathVariable String consultId)
    {
        PreDetail prescribe =prescriptionInfoService.preDetail(consultId);
        return new ResultInfo(prescribe);
    }

    /**
     * 医生新增处方
     * @param prescribe
     * @return
     */
    @PostMapping("/prescribe")
    public ResultInfo prescribe(@RequestBody @Valid  List<Prescribe> prescribe)
    {
        prescriptionInfoService.prescribe(prescribe);
        return new ResultInfo();
    }

}